<html>
	<head>
		<meta charset="utf-8">
		<title>show time</title>
		<style>
			div{
				width: 300px;
				height:30px;
				line-height: 30px;
				color:#0000FF;
				background-color: lightyellow;							}			
		</style>
			</head>
	<body>
		<button>显示时间</button>
		<div></div>
		<script>
			var btn=document.querySelector('button');
			var div=document.querySelector('div');
			btn.onclick=function(){
				div.innerText=getDate();
			}
			function getDate(){
				var date=new Date();
				var year=date.getFullYear();
				var month=date.getMonth()+1;
				var dates=date.getDate();
var arr=['星期日','星期一','星期二','星期三','星期四','星期五','星期六',];
		var day=date.getDay();
return '今天是'+year+'年'+month+'月'+dates+'日'+arr[day];			}
		</script>
	</body>
</html>